/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.itsc.ds2.model;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Juan Carlos
 */
@Entity
@Table(name = "scholarship")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Scholarship.findAll", query = "SELECT s FROM Scholarship s"),
    @NamedQuery(name = "Scholarship.findById", query = "SELECT s FROM Scholarship s WHERE s.id = :id"),
    @NamedQuery(name = "Scholarship.findByScholarshipTipe", query = "SELECT s FROM Scholarship s WHERE s.scholarshipTipe = :scholarshipTipe"),
    @NamedQuery(name = "Scholarship.findDuplicity", query = "SELECT s FROM Scholarship s WHERE s.id = :id AND s.scholarshipTipe = :scholarshipTipe")})
public class Scholarship implements Serializable {
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idScholarship")
    private Collection<Assignscholarship> assignscholarshipCollection;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "scholarshipTipe")
    private String scholarshipTipe;
    @Basic(optional = false)
    @NotNull
    @Lob
    @Size(min = 1, max = 65535)
    @Column(name = "description")
    private String description;

    public Scholarship() {
    }

    public Scholarship(Integer id) {
        this.id = id;
    }

    public Scholarship(Integer id, String scholarshipTipe, String description) {
        this.id = id;
        this.scholarshipTipe = scholarshipTipe;
        this.description = description;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getScholarshipTipe() {
        return scholarshipTipe;
    }

    public void setScholarshipTipe(String scholarshipTipe) {
        this.scholarshipTipe = scholarshipTipe;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Scholarship)) {
            return false;
        }
        Scholarship other = (Scholarship) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return " " + scholarshipTipe;
    }

    @XmlTransient
    public Collection<Assignscholarship> getAssignscholarshipCollection() {
        return assignscholarshipCollection;
    }

    public void setAssignscholarshipCollection(Collection<Assignscholarship> assignscholarshipCollection) {
        this.assignscholarshipCollection = assignscholarshipCollection;
    }
    
}
